package io.renren.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.utils.R;
import io.renren.modules.app.service.LcooperationService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zheok.testing.entity.LcooperationEntity;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;



/**
 * 合作媒体
 *
 * @author ææ¢
 * @email 2863751700@qq.com
 * @date 2022-08-23 12:21:11
 */
@RestController
@RequestMapping("testing/lcooperation")
public class LcooperationController {
    @Autowired
    private LcooperationService lcooperationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("testing:lcooperation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = lcooperationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("testing:lcooperation:info")
    public R info(@PathVariable("id") Long id){
		LcooperationEntity lcooperation = lcooperationService.getById(id);

        return R.ok().put("lcooperation", lcooperation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("testing:lcooperation:save")
    public R save(@RequestBody LcooperationEntity lcooperation){
		lcooperationService.save(lcooperation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("testing:lcooperation:update")
    public R update(@RequestBody LcooperationEntity lcooperation){
		lcooperationService.updateById(lcooperation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("testing:lcooperation:delete")
    public R delete(@RequestBody Long[] ids){
		lcooperationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
